package com.eightbears.beboy.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.eightbears.beboy.R;

public class RefuntInfoAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    private int mPosition = -1;
    public RefuntInfoAdapter() {
        super(R.layout.item_select, null);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, String name) {
        baseViewHolder.setText(R.id.tv_item_name, name)
                .setTag(R.id.rl_item, name)
                .addOnClickListener(R.id.rl_item);
        ImageView iv_checked = baseViewHolder.getView(R.id.iv_checked);
        iv_checked.setImageResource(R.mipmap.icon_weixuan);

        if(baseViewHolder.getLayoutPosition() == mPosition){
            iv_checked.setImageResource(R.mipmap.icon_xuanzhong);
        }

    }

    public void checked(int position) {
        mPosition = position;
        notifyDataSetChanged();
    }
}
